package nc;
import java.io.ByteArrayInputStream;
import java.util.*;
import org.junit.*;
public class Meituan {
    
    static class Main1 {

        private static int n, idx;
        private static int[] head;
        private static int[] next;
        private static int[] edge;
        private static int[] weight;

        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            head = new int[n + 1];
            next = new int[n * 2];
            edge = new int[n * 2];
            weight = new int[n * 2];
            idx = -1;

            for (int i = 0; i < n; i++) {
                int s = sc.nextInt(), e = sc.nextInt(), w = sc.nextInt();
                add(s, e, w);
                add(e, s, w);
            }

            int sum = 0;
            int path = 0;

            Queue<Integer> queue = new ArrayDeque<>();
            queue.offer(1);
            //到达某个节点的前驱所需要的路径之和
            Map<Integer, Integer> map = new HashMap<>();

            while (!queue.isEmpty()) {

            }

            sc.close();
        }

        private static void add(int from, int to, int w) {
            next[++idx] = head[from];
            head[from] = idx;
            edge[idx] = to;
            weight[idx] = w;
        }
    }


    static class Main2 {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);

            double sum = 0.0;
            double cnt = 0.0;
            for (int i = 1; i <= 5; i++) {
                int cur = sc.nextInt();
                sum += i * cur;
                cnt += cur;
            }
            double res = sum / cnt;
            sc.close();
            String ans = String.valueOf(res);
            int point = ans.indexOf(".");
            System.out.println(ans.substring(0, point + 2));
        }

    }

    @Test
    public void test() {
        String input = "2 2 1 1 2";
        
        try {
            System.setIn(new ByteArrayInputStream(input.getBytes()));
            Main2.main(null);
        } catch (Exception e) {
        
        } finally {
            System.setIn(System.in);
        }
    }

    static class Main3 {

        private static int max;
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int total = 0, cost = 0;

            for (int i = 0; i < n; i++) {
                int x = sc.nextInt(), y = sc.nextInt();
                if (x >= y) {
                    total += x;
                    cost += x - y;
                } else {
                    total += y;
                }
            }
            sc.close();
            System.out.println(total + " " + cost);
            
        }
    }

    static class Main4 {

        private static int max;
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int[] nums = new int[n];

            for (int i = 0; i < n; i++) {
                nums[i] = sc.nextInt();
            }
            sc.close();

            max = Integer.MIN_VALUE;
            dfs(nums, 0, new boolean[n]);
            System.out.println(max);
        }

        private static void dfs(int[] nums, int sum, boolean[] lost) {
            int n = nums.length;
            boolean flag = true;

            int i = 0;
            int last = -1;
            List<Integer> list = new ArrayList<>();
            int cnt = 0;
            while (i < n) {
                if (lost[i]) {
                    i++;
                    continue;
                }
                if (last >= 0 && nums[last] == nums[i]) {
                    nums[last]++;
                    lost[i] = true;
                    flag = false;
                    dfs(nums, sum + 1, lost);
                    lost[i] = false;
                    nums[last]--;
                }
                last = i;
                list.add(nums[i]);
                i++;
            }

            if (flag) {
                max = Math.max(max,sum);
            }
        }

    }

    @Test
    public void test4() {
        String input = "5\n1 1 1 1 1";
        
        try {
            System.setIn(new ByteArrayInputStream(input.getBytes()));
            Main4.main(null);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            System.setIn(System.in);
        }
    }

}
